package cc.eddic.practice.spring.domain;

import cc.eddic.practice.spring.jpa.BaseEntity;
import lombok.*;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "t_option")
@Builder
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class Option extends BaseEntity{

    private String answer;
    private char choice;
    private  boolean isCorrectAnswer;


    @ToString.Exclude
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "question_id")
    private Question question;

    public Option(String answer,char choice,boolean isCorrectAnswer){
        this.answer=answer;
        this.choice=choice;
        this.isCorrectAnswer=isCorrectAnswer;
    }

}
